//
//  FragmentTableViewCell.m
//  项目
//
//  Created by 张诗雨 on 15/1/7.
//  Copyright (c) 2015年 张诗雨. All rights reserved.
//

#import "FragmentTableViewCell.h"
#import "WebColor.h"
@implementation FragmentTableViewCell
- (void)dealloc
{
    [super dealloc];
    [_headPic release];
    [_nameLable release];
    [_timeImg release];
    [_addtimeLable release];
    [_shortcontentLable release];
    [_backview release];
    [_fromLable release];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [WebColor white];
        self.headPic = [UIButton buttonWithType:UIButtonTypeSystem];
        self.headPic.backgroundColor = [WebColor cornflowerBlue];
        self.headPic.layer.cornerRadius = 3;
        self.headPic.clipsToBounds = YES;
        [self.contentView addSubview:_headPic];
    
        self.nameLable = [[UILabel alloc] init];
        self.nameLable.font = [UIFont systemFontOfSize:16.0f];
        self.nameLable.textColor = [WebColor steelBlue];
        [self.contentView addSubview:_nameLable];
        [_nameLable release];
        
        self.timeImg = [[UIImageView alloc] init];
        self.timeImg.image = [UIImage imageNamed:@"suipian_time.png"];
        [self.contentView addSubview:self.timeImg];
        [_timeImg release];
        
        self.addtimeLable = [[UILabel alloc] init];
        self.addtimeLable.textColor = [WebColor slateGray];
        self.addtimeLable.font = [UIFont systemFontOfSize:15.0f];
        [self.contentView addSubview:self.addtimeLable];
        [_addtimeLable release];
        
        self.shortcontentLable = [[UILabel alloc] init];
        self.shortcontentLable.font = [UIFont systemFontOfSize:16.0f];
        self.shortcontentLable.numberOfLines = 0;
        [self.shortcontentLable sizeToFit];
        [self.contentView addSubview:_shortcontentLable];
        [_shortcontentLable release];
        
        self.backview = [[UIView alloc] init];
        self.backview.backgroundColor = [WebColor aliceBlue];
        [self.contentView addSubview:self.backview];
        
        UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 40, 30)];
        lable.text = @"来自";
        lable.textColor = [WebColor slateGray];
        lable.font = [UIFont systemFontOfSize:13.0f];
        [self.backview addSubview:lable];
        [lable release];
        
        self.fromLable = [[UILabel alloc] initWithFrame:CGRectMake(70, 0, 40, 30)];
        _fromLable.textColor = [WebColor steelBlue];
        _fromLable.font = [UIFont systemFontOfSize:13.0f];
        [self.backview addSubview:_fromLable];
        [_fromLable release];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.headPic.frame = CGRectMake(10, 10, 85, 85);
    self.nameLable.frame = CGRectMake(110, 25, self.frame.size.width - 120, 40);
    self.timeImg.frame = CGRectMake(110, 70, 15, 15);
    self.addtimeLable.frame = CGRectMake(130, 70, 70, 25);
    self.shortcontentLable.frame = CGRectMake(10, 120, self.frame.size.width - 20,30);
    [self.shortcontentLable sizeToFit];
    self.backview.frame = CGRectMake(0, 140 + self.shortcontentLable.frame.size.height, self.frame.size.width,30);

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
